<div ng-controller="specialInvoiceListCtrl">
    <div class="table-header table-header-border clearfix ng-scope">
        <span class="fl lh30 f14">特批发票</span>
    </div>
    <my-nav data-nav-items="filterDataCities" onchanged="changeCity" data-title="城市区域:" data-text-field="areaName"></my-nav>
    <my-nav data-nav-items="filterFulfils" onchanged="changeFulfil" data-title="是否兑现:"></my-nav>    

    <div class="table-header mt20 clearfix ng-scope">
        <span class="fl lh30 f14">特批发票列表</span>
        <div class="fr btn-group">
            <input class="input-text fl" style="width: 470px;" type="text" placeholder="发票台头/合同编号/发票号码"
                   ng-if="userAuthList.indexOf('0400') !== -1"
                   ng-model="query.keyword"
                   ng-enter="query.execute()"/>
            <a class="btn" href="javascript: void(0)"
               ng-if="userAuthList.indexOf('0400') !== -1"
               ng-click="query.execute()">查询</a>
            <a href="javascript:;" class="btn" id="addSpecialInvoiceButton"
                ng-if="userAuthList.indexOf('0401') !== -1"
                ui-dialog="新建特批发票"
                ui-dialog-data=""
                ui-dialog-init="onInvoiceEditShow(null,$dialog,$dialogScope)"
                ui-dialog-ok="saveInvoice($dialog,$dialogScope)"
                ui-dialog-on-close="onCloseSpecialInvoice($dialogScope)"
                ui-dialog-cache="false"
                ui-dialog-url="${require('./dialog/special_invoice_edit.html?url')}">新建特批发票</a>
            <a class="btn"
               ng-if="userAuthList.indexOf('0402') !== -1"
               href="/api/index.php?r=/special-approval-invoice/export-special-approval-invoice-list&keyword={{query.keyword}}">
                导出
            </a>
        </div>
    </div>

    <div id="grid" class="table-responsive mt10">
        <table class="table table-hover">
            <thead>
            <tr>
                <th width="40" class="text-center">序号</th>
                <th width="160">开票单位</th>
                <th width="200">合同信息</th>
                <th width="200">发票信息</th>
                <th width="180">特批类型</th>
                <th width="150">特批信息</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in invoices">
                <td class="text-center"><p ng-bind="$index + 1 + startPageIndex"></p></td>
                <td>
                    <p>{{record.invoice_company_name}}</p>
                </td>
                <td>
                    <p>{{record.contract_code}}</p>
                    <p class="tab-text-gray">{{record.contract_company_name}}</p>
                </td>
                <td>
                    <p>发票抬头：{{record.customer_name}}</p>
                    <p>发票号码：{{record.invoice_no}}</p>
                    <p class="tab-text-gray">发票日期：{{record.invoice_date|strdate:'yyyy-MM-dd'}}</p>
                </td>
                <td>
                    <p ng-bind="record.category_name"></p>
                </td>
                <td>
                    <p>兑现责任人：{{record.principal_name}}</p>
                    <p>承诺日期：{{record.promise_fulfil_time|strdate:'yyyy-MM-dd'}}</p>
                    <p>兑现日期：{{record.actual_fulfil_time|strdate: 'yyyy-MM-dd'}}</p>
                </td>             
                <td>
                    <div ng-if="userAuthList.indexOf('0401') !== -1">
                        <a href="javascript:;"
                           class="tab-text"
                           ui-dialog="编辑特批发票"
                           ui-dialog-data="record"
                           ui-dialog-show="onInvoiceEditShow(record,$dialog,$dialogScope)"
                           ui-dialog-ok="saveInvoice($dialog,$dialogScope)"
                           ui-dialog-on-close="onCloseSpecialInvoice($dialogScope)"
                           ui-dialog-cache="false"
                           ui-dialog-url="${require('./dialog/special_invoice_edit.html?url')}">编辑</a>
                        <a  ng-if="!(record.receivables_amount>0) && record.is_red_invoice!=1 && !record.red_by_invoice_id"
                            href="javascript:;"
                            class="ml10 tab-text"
                            ng-click="removeInvoice(record.special_approval_invoice_id)">删除
                        </a>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" style="display:none"><span>暂无数据</span></div>
    </div>
    <div id="pagination" class="pagination"></div>
</div>
